const fs = require('fs');

//创建流式通道
const ws = fs.createWriteStream('./观书有感.txt');

ws.write('锦瑟无端五十弦，一弦一柱思华年\r\n');
ws.write('庄生晓梦迷蝴蝶，望帝春心托杜鹃\r\n');
ws.write('沧海月明珠有泪，蓝田日暖玉生烟\r\n');
ws.write('此情可待成追忆，只是当时已惘然\r\n');

//关闭流通道
ws.close();